package com.tjsinfo.tjsoa.messageImportant.bo;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import com.tjsinfo.tjsoa.Dao.IQbcDao;
import com.tjsinfo.tjsoa.messageImportant.dao.IMessageImportantFileUploadDAO;
import com.tjsinfo.tjsoa.messageImportant.dao.IMessageImportantMainDAO;
import com.tjsinfo.tjsoa.messageImportant.vo.MessageImportantFileUpload;
import com.tjsinfo.tjsoa.messageImportant.vo.MessageImportantMain;
import com.tjsinfo.tjsoa.system.vo.TSystemUser;


public class MessageImportantFileUploadBo implements IMessageImportantFileUploadBo {
	private IQbcDao qbcDao;
	private IMessageImportantFileUploadDAO importantFileUploadDAO;
	
	/* (non-Javadoc)
	 * @see com.tjsinfo.tjsoa.messageImportant.bo.IMessageImportantFileUploadBo#findByMainId(java.lang.String)
	 */
	public List findByMainId(String mainId) {
		DetachedCriteria criteria = DetachedCriteria.forClass(MessageImportantFileUpload.class);
		criteria.add(Restrictions.eq("mainId", mainId));
		List list = qbcDao.getCriteria(criteria);
		return list;
	}
	
	/* (non-Javadoc)
	 * @see com.tjsinfo.tjsoa.messageImportant.bo.IMessageImportantFileUploadBo#findById(java.lang.String)
	 */
	public MessageImportantFileUpload findById(String id) {
		DetachedCriteria criteria = DetachedCriteria.forClass(MessageImportantFileUpload.class);
		criteria.add(Restrictions.eq("uuid", id));
		List list = qbcDao.getCriteria(criteria);
		return (MessageImportantFileUpload) list.iterator().next();
	}
	
	/* (non-Javadoc)
	 * @see com.tjsinfo.tjsoa.messageImportant.bo.IMessageImportantFileUploadBo#delete(java.lang.String)
	 */
	public void delete(String id) {
		MessageImportantFileUpload main = this.findById(id);
		importantFileUploadDAO.delete(main);
	}
	
	/* (non-Javadoc)
	 * @see com.tjsinfo.tjsoa.messageImportant.bo.IMessageImportantFileUploadBo#save(com.tjsinfo.tjsoa.messageImportant.vo.MessageImportantMain)
	 */
	public String save(MessageImportantFileUpload main) {
		String i =null; 
		i=importantFileUploadDAO.save(main);
		return i;
	}

	/* (non-Javadoc)
	 * @see com.tjsinfo.tjsoa.messageImportant.bo.IMessageImportantFileUploadBo#setQbcDao(com.tjsinfo.tjsoa.Dao.IQbcDao)
	 */
	public void setQbcDao(IQbcDao qbcDao) {
		this.qbcDao = qbcDao;
	}

	/* (non-Javadoc)
	 * @see com.tjsinfo.tjsoa.messageImportant.bo.IMessageImportantFileUploadBo#setImportantFileUploadDAO(com.tjsinfo.tjsoa.messageImportant.dao.IMessageImportantFileUploadDAO)
	 */
	public void setImportantFileUploadDAO(
			IMessageImportantFileUploadDAO importantFileUploadDAO) {
		this.importantFileUploadDAO = importantFileUploadDAO;
	}
}
